#!/usr/bin/env python
# -- coding=utf-8 --
from tornado import httpserver, ioloop, options
from tornado.web import *

options.define("port", 8000, type=int, help="请输入端口号")


class IndexHandler(RequestHandler):
    def post(self):
        para_a = self.get_argument('a')
        print(para_a)
        print("*" * 10)
        para_b = self.get_argument('b', default='db', strip=True)
        print(len(para_b))
        para_b = self.get_argument('b', default='db', strip=False)
        print(len(para_b))
        self.write("hello")


def main():
    options.options.parse_command_line()
    print(options.options.port)
    app = Application([
        (r'/', IndexHandler),
    ])
    http_server = httpserver.HTTPServer(app)
    http_server.listen(options.options.port)
    ioloop.IOLoop.current().start()


if __name__ == '__main__':
    main()
